package main

import "fmt"

func main() {

	// const rewardPoints int = 10
	// var rewardPoints = 10 //totalRewadPoints会异常
	const rewardPoints = 10 //类型推断,const变量本身是无类型的

	fmt.Printf("Default typeof rewardPoints is %T\n", rewardPoints) // int

	var totalRewadPoints float64 = 150.3

	// Adding untyped constant to a float64 -valid, constant adapts
	// totalRewadPoints = totalRewadPoints + rewardPoints // const变量没有类型，所以可以做类型适配

	totalRewadPoints += rewardPoints // 相当于totalRewadPoints += 10

	fmt.Printf("totalRewadPoints is %T\n", totalRewadPoints) // float64
	fmt.Printf("Updated loyalty points %.2f\n", totalRewadPoints)
}
